<?php
header("Access-Control-Allow-Origin:*");
header("Content-Type:application/json;charset=utf-8");
include "config.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
    $phoneNumber = $_REQUEST["phoneNumber"];
    $pwd = $_REQUEST["pwd"];
    if(!empty($phoneNumber)&&!empty($pwd )){
        $insertSQL = "INSERT INTO zols(phoneNumber,password) VALUES(?,?)";
        $stmt = $conn->prepare($insertSQL);
        $stmt->bind_param("ss",$phoneNumber,$pwd);
        $stmt->execute();
        if($stmt->affected_rows>=1){
            print_r(json_encode(array("status"=>1,"msg"=>"注册成功")));
        }
        else{
            print_r(json_encode(array("status"=>0,"msg"=>"用户已存在,注册失败")));
        }
    }
}
else{
    print_r(json_encode(array("status"=>-1,"msg"=>"不接受get方式传输")));
}

/**
 * Created by PhpStorm.
 * User: xzw
 * Date: 2018/7/27
 * Time: 9:51
 */